package reader.app.slice;

import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.agp.colors.RgbColor;
import ohos.agp.components.DependentLayout;
import ohos.agp.components.Text;
import ohos.agp.components.element.ShapeElement;
import ohos.agp.utils.Color;
import ohos.agp.utils.TextAlignment;

public class SecondAbilitySlice extends AbilitySlice {
    public void onStart(Intent intent){
        DependentLayout layout=new DependentLayout(this);
        layout.setHeight(DependentLayout.LayoutConfig.MATCH_PARENT);
        layout.setWidth(DependentLayout.LayoutConfig.MATCH_PARENT);
        ShapeElement element=new ShapeElement();
        element.setRgbColor(new RgbColor(172,177,46));
        layout.setBackground(element);

        DependentLayout.LayoutConfig layoutConfig=new DependentLayout.LayoutConfig(DependentLayout.LayoutConfig.MATCH_PARENT, DependentLayout.LayoutConfig.MATCH_PARENT);
        Text text=new Text(this);
        text.setText("星星之火可以燎原！没有人能够熄灭满天星光！在一起就可以！加油华为，加油中国，加油鸿蒙！");
        text.setTextColor(Color.RED);
        text.setTextAlignment(TextAlignment.CENTER);
        text.setTextSize(100);
        text.setTruncationMode(Text.TruncationMode.AUTO_SCROLLING);
        text.setAutoScrollingCount(Text.AUTO_SCROLLING_FOREVER);
        text.startAutoScrolling();
        text.setLayoutConfig(layoutConfig);
        layout.addComponent(text);
        super.setUIContent(layout);
        System.out.println("==================="+intent);
    }
}
